package com.lbssoft.gpsbd.dao;

import com.lbssoft.gpsbd.model.DeviceType;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeviceTypeMapper {
	
	/**
	 * 获取设备类型
	 * @return
	 */
	@Select("SELECT * FROM lbs_device_type ${where} ORDER BY level ")
	List<DeviceType> list(@Param("where") String where);

	/**
	 * 添加类型
	 * @param type
     */
	@Insert("INSERT INTO lbs_device_type(name,port,description,level,disabled) VALUE(#{name},#{port},#{description},null,#{disabled})")
	void add(DeviceType type);

	/**
	 * 删除类型
	 * @param id
     */
	@Delete("DELETE FROM lbs_device_type where id = #{id}")
	void delete(@Param("id") int id);

	/**
	 * 更新类型
	 * @param type
     */
	@Update("UPDATE lbs_device_type SET name =#{name},port = #{port},description=#{description},disabled=#{disabled} where id = #{id}")
	void update(DeviceType type);
	
	
	
}
